<template>
  <div class="orderlist">
    <van-nav-bar title="调度订单"
                 style="z-index:1001"
                 @click-left="onClickLeft"
                 fixed>
      <van-icon name="arrow-left" slot="left" color="#333" size="0.6rem"/>
      <!-- <van-icon :name="require('@/assets/img/home.png')"
                slot="left"
                color="#333"
                size="0.6rem" /> -->
      <span></span>
      <van-icon :name="require('@/assets/img/computer.png')"
                slot="right"
                color="#333"
                size="0.6rem" />
    </van-nav-bar>
    <div class="ordersearch" style="z-index:1001">
      <div class="searchLeft">
        <form action="javascript:return true">
          <van-search v-model="value"
                      show-action
                      placeholder="运单号/货物名称"
                      @search="onSearch">
            <!-- <div slot="action"
                @click="onSearch(value)"
                v-show='isshowSearch'>搜索</div> -->
            <div slot="action"
                @click="onSearch(value)">搜索</div>
          </van-search>
        </form>
      </div>
      <van-icon :name="require('@/assets/img/searchIcon.png')"
              slot="right"
              color="#333"
              size="0.44rem"
              class-prefix="menuIcon" />
    </div>

    <div class="list">
      <!--<van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">-->
      <div class="info" 
            v-for="(orderItem,index) in orderList"
           :key="index">
           <img class="labelIcon" :src="require(orderItem.deliveryFlag==0?'@/assets/img/pickUpIcon.png':'@/assets/img/sendIcon.png')">
        <div @click='godetail(index)' class="lsit">
          <div class="label labelTitle">
            <span class="tit">运单号:</span>
            <span class="con">{{orderItem.orderFk}}</span>
            <span class="titleRight">{{orderItem.orderFk}}</span>
          </div>
          <div class="label">
            <span class="tit">上门时间:</span>
            <span class="con">{{orderItem.orderTime}}</span>
          </div>
          <div class="label">
            <span class="tit">货量总计：</span>
            <span class="con">{{orderItem.goodsAmount}}件-{{orderItem.goodsTon*1000}}公斤-{{orderItem.goodsCube}}方</span>
          </div>
          <div class="label">
            <span class="tit">货物情况:</span>
            <span class="con">{{orderItem.goodsRemark}}</span>
          </div>
          <div class="label">
            <span class="tit">装车地点:</span>
            <span class="con">{{orderItem.loadAddress}}</span>
          </div>
          <div class="label lastlabel">
            <span class="tit">里程数</span>
            <span class="con">{{orderItem.addressMiles}}公里</span>
          </div>
        </div>
        <div class="times">
          <p>{{orderItem.inputTime}}</p>
        </div>
      </div>
      <!--</van-list>-->
       <div class="Receivables" >
        <button class="Receivables-btn" @click="addOrder">新增调度</button>
      </div>
      <van-pagination v-model="pageIndex"
                    :total-items="totalCount"
                    :show-page-size="3"
                    force-ellipses
                    @change='changpage'
                    class='page'
                    :page-count='pagecount'
                    v-show='totalCount>2' />
    </div>
  </div>
</template>
<script>
import Vue from 'vue';
import { getOrderList } from '@/api/pickup';
import { Pagination } from 'vant';
Vue.use(Pagination);
import { Icon, Field, Button, Image, Search, Toast, List,Checkbox,SubmitBar,Popup,Col, Row,Calendar } from 'vant';
Vue.use(Icon);
Vue.use(Field);
Vue.use(Button);
Vue.use(Image);
Vue.use(Search);
Vue.use(Toast);
Vue.use(List);
Vue.use(Checkbox);
Vue.use(SubmitBar);
Vue.use(Popup);
Vue.use(Col);
Vue.use(Row);
Vue.use(Calendar);
export default {
  data () {
    return {
      orderList:[],
      value:'',
      goodsName: '',
      orderFk: '',
      orderSrc: 'h5',
      startInputTime:'',
      endInputTime:'',
      pageSize:10,
      pageIndex:1,
      totalCount:0,
      pagecount:0
    };
  },
  mounted () {
    this.getorderlist();
  },
  methods: {
    onSearch (val) {
      this.serachTxt = val;
      this.getorderlist();
    },
    getorderlist () {
      let parm = {
        goodsName: this.goodsName,
        orderFk: this.orderFk,
        orderSrc: 'h5',
        startInputTime:this.startInputTime,
        endInputTime:this.endInputTime,
        pageSize:this.pageSize,
        pageIndex:this.pageIndex
      };

      getOrderList(parm).then(res => {
        if(res.code == 200){
          this.orderList = res.data.salerOrderInfoList;
          this.totalCount = res.data.count;
          this.pagecount = Math.ceil(res.data.count / this.pageSize);
        }else{
          this.$toast.fail('暂无数据');
        }
      });
    },
    godetail (index) {
      window.localStorage.setItem("orderDetail",JSON.stringify(this.orderList[index]));
      this.$router.push({
        path: '/pickUpDetail',
        query: {}
      });
    },
    addOrder:function(){
        this.$router.push({
          path: '/addPickUpOrder',
          query: {}
        });
    },
    changpage (val) {
      this.pageIndex = val;
      this.getorderlist();
    },
    onClickLeft(){
      this.$router.back();
    }
  }
};
</script>
<style lang="scss">
.orderlist {
  width: 100%;
  padding-bottom: 60px;
}
.ordertlistlist {
  width: 100%;
  height: 43px;
  display: flex;
  border-bottom: 1px solid #efefef;
  align-items: center;
  justify-content: space-between;
  padding: 0 19px;
  box-sizing: border-box;
  background: #fff;
  p {
    font-family: PingFangSC-Medium;
    font-size: 18px;
    color: #333333;
  }
  img {
    width: 21px;
    height: 19px;
  }
}

.ordersearch {
  background: #fff;
  // padding-top: 46px;
  position: fixed;
  top: 46px;
  left:0;
  width: 100%;
  z-index: 2;
}

.list {
  // padding: 10px 16px 0 16px;
  padding: 105px 16px 0 16px;
  background: #f8f8f8;
  text-align: center;
}

.nolist {
  width: 100%;
  height: 100%;
}

.info {
  background: #fff;
  padding: 0 14px 17px 14px;
  margin-bottom: 10px;
  position: relative;
  .label {
    font-family: PingFangSC-Regular;
    font-size: 14px;
    text-align: left;
    padding-top: 14px;
    display: flex;
    .tit {
      color: #999999;
      width: 73px;
    }
    .con {
      color: #333333;
      flex: 1;
    }
    .coninfo {
      color: #00b578;
      flex: 1;
    }
  }
  .logInfo {
    display: flex;
    justify-content: space-between;
    span {
      display: block;
    }
    img {
      width: 46px;
      height: 11px;
    }
    .arrow {
      width: 54px;
    }
    .add {
      width: 128px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-family: PingFangSC-Medium;
      font-size: 16px;
      color: #333333;
      letter-spacing: 0;
      padding-top: 4px;
    }
    .person {
      font-family: PingFangSC-Regular;
      font-size: 13px;
      color: #666666;
      padding-top: 5px;
    }
    .arrowtext {
      font-family: PingFangSC-Medium;
      font-size: 13px;
      color: #f18d00;
      margin-top: -5px;
    }
  }
  .lastlabel {
    border-bottom: 1px solid #efefef;
    padding-bottom: 7px;
  }
  .times {
    font-family: PingFangSC-Regular;
    font-size: 14px;
    color: #666666;
    text-align: left;
    padding-top: 7px;
  }
  .rightbtn {
    display: flex;
    justify-content: flex-end;
    padding-top: 7px;
    text-align: center;
    div {
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .btn-modify {
      width: 85px;
      height: 32px;
      line-height: 32px;
      background: #fdf3e4;
      border: 1px solid #f18d00;
      border-radius: 3px;
      margin-left: 15px;
      span {
        font-family: PingFangSC-Regular;
        font-size: 14px;
        color: #f18d00;
      }
    }
    .btn-confirm {
      width: 85px;
      height: 32px;
      background: #f18d00;
      border: 1px solid #f18d00;
      border-radius: 3px;
      margin-left: 15px;
      span {
        font-family: PingFangSC-Regular;
        font-size: 14px;
        color: #fff;
      }
    }
    .btn-error {
      width: 85px;
      height: 32px;
      background: #ff6540;
      border: 1px solid #ff6540;
      border-radius: 3px;
      margin-left: 15px;
      span {
        font-family: PingFangSC-Regular;
        font-size: 14px;
        color: #fff;
      }
    }
  }
}

.page .van-pagination__item--active {
  background: #fdf3e4;
}

.page .van-pagination__item {
  color: #f18d00;
}

.page .van-pagination__item:active {
  color: #fff;
  background-color: #fdf3e4;
}

.page .van-pagination__item--disabled,
.van-pagination__item--disabled:active {
  color: #646566;
  background-color: #999;
  cursor: not-allowed;
  opacity: 0.5;
}

.van-dialog__confirm,
.van-dialog__confirm:active {
  color: #f18d00;
}
.Receivables {
  width: 100%;
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  bottom:0px;
  left:0;
  background: #fff;
  z-index: 3;
  .Receivables-btn {
    width: 343px;
    height: 44px;
    border-radius: 4px;
    background: #FF6540;
    text-align: center;
    line-height: 44px;
    border: none;
    outline: none;
    color: #FFFFFF;
    font-size: 18px;
  }
}
.selectrece {
  z-index: 100;
  position: absolute;
  left: 15px;
  top: 15px;
  margin-right: 15px;
}
.lsit {
  z-index: 0;
  position: relative;
}
.setpriceall {
  height: 375px;
  height: 60px;
  display: flex;
  position: fixed;
  bottom: 0;
  left:0;
  z-index: 3;
  background: #fff;
  width: 100%;
  .setpriceall_left{
    width: 212px;
    padding: 4px 11px 9px 11px;
    box-sizing: border-box;
  }
  .setpriceall_right{
    width: 163px;
  }
  div {
    // flex: 1;
  }
  .all{
    margin-right: 62px;
  }
  .noselect {
    width: 80px;
    height: 60px;
    font-size: 18px;
    color: #FFFFFF;
    background: #F18D00 100%;
    position: relative;
    left: 0;
    outline: none;
    border: none;
    float: left;
  }
  .priceset{
     width: 80px;
    height: 60px;
    font-size: 18px;
    color: #FFFFFF;
    background: #FF6540 100%;
    float: right;
    position: relative;
    left: 0;
    border: none;
    outline: none;
    float: left;
  }
}
.backgroudimage{
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    background: rgba(0,0,0,.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    .ims {
      width: 100%;
      height: 100%;
    }
  }
  .searchLeft{
    width: 323px;
    float:left;
  }
  .menuIcon{
    float: left;
    margin-top: 17px;
    padding-left: 10px;
    padding-top: 2px;
    border-left: 1px solid #979797;
  }
  .menuItem{
   padding: 0 20px;
   text-align:center;
   box-sizing:border-box;
   text-align: left;
   margin-top: 15px;
  }
  .menuItem .van-row{
    text-align: center;
  }
  .menuItem>label{
    font-size: 15px;
    color: #333333;
    font-weight: bold;
    margin-bottom: 10px;
    display: block;
  }
  .menuItem .van-col{
    font-size: 12px;
    color: #666;
    background: #F3F3F3;
    border-radius: 2px;
    border-radius: 2px;
    width: 100px;
    height: 30px;
    line-height: 30px;
  }
  .active{
    color: #F18D00 !important;
    background: #FFF8F4 !important;
    border: 1px solid #F18D00;
  }
  .orderDate{
    background: #FFFFFF;
    border: 1px solid #999999;
    border-radius: 2px;
    border-radius: 2px;
    width: 100px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    color: #999;
    display: inline-block;
    font-size: 12px;
    box-sizing: border-box;
    margin-bottom: 15px;
  }
  .searchDate{
    margin-bottom: 15px;
  }
  .searchDate span{
    display: inline-block;
    color: #999;
    margin: 0 4.5px;
    height: 30px;
    line-height: 30px;
  }
  .van-calendar__selected-day{
    width: 39px;
    height: 39px;
    border-radius: 50%;
  }
  .van-calendar__header-subtitle{
    height: 24px;
    line-height: 24px;
  }
  .btns{
    width: 100%;
    box-shadow: 0 -1px 12px 0 rgba(0,0,0,0.12);
    padding: 15px;
  }
  .btns div{
    width: 164px;
    box-sizing: border-box;
    text-align: center;
    height: 44px;
    line-height: 44px;
    font-size: 18px;
    letter-spacing: 0.58px;
    display: inline-block;
  }
  .btn_cancel{
    color: #F18D00;
    border: 1px solid #F18D00;
    border-radius: 2px;
  }
  .btn_confirm{
    background: #F18D00;
    border-radius: 2px;
    color: #fff;
    margin-left: 16px;
  }
  .clearDate{
    display: inline-block;
    color: #f18d00;
    font-size: 12px;
    line-height: 30px;
    margin-left: 18px;
    width: 50px;
    text-align: center;
  }
  .van-nav-bar__text{
    color: #FF6540;
  }
  .labelTitle{
    padding: 15px 0;
    border-bottom: 1px solid #efefef;
    padding-left: 5px;
  }
  .titleRight{
    float: right;
    color: #F18D00;
    font-size: 16px;
  }
  .labelIcon{
    position: absolute;
    top: 0;
    left: 0;
    width: 33px;
    height: 33px;
  }
</style>


